package com.xquan.order.controller;

import com.xquan.api.dto.OrderDetailDTO;
import com.xquan.api.dto.OrderFormDTO;
import com.xquan.common.domain.R;
import com.xquan.order.service.OrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/orders")
@RequiredArgsConstructor
public class OrderController {

    private final OrderService orderService;

    @PostMapping
    public R<Long> createOrder(@RequestBody OrderFormDTO orderFormDTO){
        return orderService.createOrder(orderFormDTO);
    }

    @PostMapping("/one")
    public R<Long> createOneOrder(@RequestBody OrderDetailDTO orderDetailDTO){
        return orderService.createOneOrder(orderDetailDTO);
    }

}
